// #include <bits/stdc++.h>
#include <cstdio>
using namespace std;
typedef long long ll;
const int N = 200000, M = 500000;
int n, m, t, t1[N], t2[N], a[N], c[N];
struct edge {
  int v, nx;
} e[M];
int ne, hd[N];
void build(int u, int v) { ++ne, e[ne] = (edge){v, hd[u]}, hd[u] = ne; }
void dfs(int id) {
  ++t, t1[id] = t;
  for (int i = hd[id]; i; i = e[i].nx) dfs(e[i].v);
  t2[id] = t;
}
int lowbit(int x) { return x & -x; }
void update(int id, int num) {
  for (; id <= n;) {
    c[id] += num;
    id += lowbit(id);
  }
}
int getsum(int id) {
  int res = 0;
  for (; id;) {
    res += c[id];
    id -= lowbit(id);
  }
  return res;
}
int main() {
  scanf("%d\n", &n);
  int u, v;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d\n", &u, &v);
    build(u, v);
  }
  dfs(1);
  for (int i = 1; i <= n; ++i) {
    a[i] = 1;
    update(t1[i], 1);
  }
  scanf("%d\n", &m);
  char s;
  int id;
  for (int i = 1; i <= m; ++i) {
    scanf("%c%d\n", &s, &id);
    if (s == 'Q')
      printf("%d\n", getsum(t2[id]) - getsum(t1[id] - 1));
    else {
      a[id] = 0 - a[id];
      update(t1[id], a[id]);
    }
  }
}
